package com.brucekong.slm.service.console;

import com.brucekong.slm.mapper.console.TopMapper;
import com.brucekong.slm.model.console.TopCardDomain;
import com.brucekong.slm.model.console.TopSearchDomain;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TopService {

    @Resource
    private TopMapper topMapper;

    public PageInfo<TopSearchDomain> getTopSearch(int page, int limit) {
        PageHelper.startPage(page, limit);
        List<TopSearchDomain> topSearchDomainList = topMapper.getTopSearch(page, limit);
        return new PageInfo<>(topSearchDomainList);
    }

    public PageInfo<TopCardDomain> getTopCard(int page, int limit) {
        PageHelper.startPage(page, limit);
        List<TopCardDomain> topCardDomainList = topMapper.getTopCard(page, limit);
        return new PageInfo<>(topCardDomainList);
    }
}